<?php
    header("content-type:text/html;charset=utf-8");
    $config = include_once('../../public/config/config.php');
    include_once('../../public/func/db.php');
    $table = 'kinds';
    $_POST['ctime'] = time();
    if(empty($_POST['category'])){
        die("<script>alert('类别不能为空');window.location.href='updatekinds.php?id=".$_POST['id']."'</script>");
    }
    $res = update($config,$table,$_POST);
    if(!empty($res)){
        echo "<script>alert('更改失败');window.location.href='upadatekinds.php?id=".$_POST['id']."'</script>";
    }else{
        echo "<script>alert('更改成功');window.location.href='kinds.php'</script>";
    }
?>